# Makefile for TeXtallion
# Tiny almost-Kiss Word Processor
# http://anamnese.online.fr/site2/textallion/docs/presentation.html
# License: http://en.wikipedia.org/wiki/BSD_licenses
#
# get newest txt2tags   at http://txt2tags.googlecode.com/svn/trunk/txt2tags
# get newest textallion at http://textallion.googlecode.com 
#
# This is a Makefile for *GNU make*, the default for Linux.
# On *BSD systems, you'll need to use "gmake" instead of "make"


TEXTALLIONFOLDER = /usr/share/textallion/
# <!> keep /usr/share/textallion if it is written so!

ifeq ($(wildcard /usr/bin/python2),)
 PYTHONVER = python 
else 
 PYTHONVER = python2
endif

TXT2TAGS = $(PYTHONVER) $(TEXTALLIONFOLDER)/contrib/txt2tags/txt2tags
#TXT2TAGS = txt2tags

ifdef TEXTALLIONDOC
  DOCUMENT = $(TEXTALLIONDOC)
else
  DOCUMENT = pmwiki-efo
  #DOCUMENT = the_blue_death
  #DOCUMENT = la_mort_bleue
  #DOCUMENT = template
  #DOCUMENT = un_nouveau_monde
  #DOCUMENT = un_nouveau_monde_gbl
  #DOCUMENT = who_are_you
  #DOCUMENT = sample
endif

DOCUMENT_TITLE = Documentation pour PmWiki-efo
DOCUMENT_AUTHOR = Eric Forgeot
DOCUMENT_TAGS = pmwiki, wiki, edition, publication, site internet
DOCUMENT_LANGUAGE = fr 
#DOCUMENT_COVER = $(TEXTALLIONFOLDER)/images/sample_cover.png
DOCUMENT_COVER = $(DOCUMENT).png

PDFREADER = evince
EPUBREADER = ebook-viewer 
HTMLREADER = firefox
DIFFTOOL = meld
EDITTOOL = geany


info:
	# make: + distrib / html / pdf / pdfsmall / booklet / clean 
	
all:    epub html pdf website clean

#distrib: html clean
#	-rm $(DOCUMENT).zip
#	-rm -fr $(DOCUMENT)
#	-mkdir $(DOCUMENT)
#	-cp * $(DOCUMENT)
#	zip $(DOCUMENT).zip -r $(DOCUMENT) -x $(DOCUMENT).zip

html:
	$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/xhtml.html -t xhtml --css-inside --toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t

htmlhandhelds:
	$(TXT2TAGS) -t xhtml --no-style  --style=$(TEXTALLIONFOLDER)/includes/sample_handheld.css --toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t

edit:
	$(EDITTOOL) $(DOCUMENT).t2t
txt:
	$(TXT2TAGS) --no-headers -t txt $(DOCUMENT).t2t

pdf:
	$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/latex.tex -t tex --toc --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
	-pdflatex -interaction batchmode $(DOCUMENT).tex
	-makeindex $(DOCUMENT).idx
	-pdflatex -interaction batchmode $(DOCUMENT).tex
	# (the compilation of the latex document is duplicated so the TOC generated the first time will be included the second time)
	-pdflatex -interaction batchmode $(DOCUMENT).tex
	# and one again because of makeindex

xetex:
	$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/xetex.tex -t tex --toc --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
	-xelatex -interaction batchmode $(DOCUMENT).tex
	-xelatex -interaction batchmode $(DOCUMENT).tex
	
	
readpdf:	
	$(PDFREADER) $(DOCUMENT).pdf

readhtml:	
	$(HTMLREADER) $(DOCUMENT).html

readindex:	
	$(HTMLREADER) index_$(DOCUMENT).html

readepub:	
	$(EPUBREADER) $(DOCUMENT).epub

read:
	make readpdf

pdfsmall: pdf
	-pdfnup $(DOCUMENT).pdf --nup 2x1

booklet: pdf
	-pdf2ps $(DOCUMENT).pdf
	-psbook $(DOCUMENT).ps | psnup -2 > $(DOCUMENT)_booklet.ps
	-ps2pdf $(DOCUMENT)_booklet.ps


slidy: 
	$(TXT2TAGS) -C $(TEXTALLIONFOLDER)/templates/slidy.conf.t2t -T $(TEXTALLIONFOLDER)/templates/slidy -t xhtml --css-inside -o $(DOCUMENT)_slide.html $(DOCUMENT).t2t

beamer: 
	$(TXT2TAGS) --no-style --no-infile -C $(TEXTALLIONFOLDER)/templates/beamer.conf.t2t -C $(TEXTALLIONFOLDER)/core/textallion_beamer.t2t -T $(TEXTALLIONFOLDER)/templates/beamer -t tex -o $(DOCUMENT)_slide.tex $(DOCUMENT).t2t
	pdflatex $(DOCUMENT)_slide.tex
	
	
# uses html tidy

tidy:
	-tidy -asxhtml --tidy-mark 1 --wrap 0 --clean 1 --output-xhtml 1 --input-encoding utf8 --doctype strict $(DOCUMENT).html > $(DOCUMENT)2.html
	cat $(DOCUMENT)2.html | sed -e "s/<meta name=\"generator\" content=\"http:\/\/txt2tags.org\" \/>//g" | sed -e "s/border=\"0\"//g" | sed -e "s/lang=\"fr\"//g" | sed -e "s/border=\"0\"//g" | sed -e "s/<\?xml version=\"1.0\" encoding=\"utf8\"\?>//g" | sed -e "s/name=\"toc[0-9]\"//g"> $(DOCUMENT).html

# uses calibre

	
epub:
	$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/xhtml.html -t xhtml --no-style --toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t
	cat $(DOCUMENT).html | sed -e "s/<audio\(.*\)audio>//g" > $(DOCUMENT)2.html
	mv $(DOCUMENT)2.html $(DOCUMENT).html
	-make tidy
	cat $(DOCUMENT).html | sed -e "s/&#10086;/*/g" | sed -e "s/&#10087;/*/g" | sed -e "s/&#10037;/*/g" | sed -e "s/&#9788;/*/g" | sed -e "s/&#9789;/*/g" | sed -e "s/&#9790;/*/g" | sed -e "s/&#9675;/*/g"  > $(DOCUMENT)2.html
	mv $(DOCUMENT)2.html $(DOCUMENT).html
	#
	ebook-convert $(DOCUMENT).html $(DOCUMENT).epub --max-levels 0 --pretty-print --level1-toc //h:h1 --level2-toc //h:h2 --level3-toc //h:h3 --max-toc-links 0 --toc-threshold 3  --chapter-mark pagebreak  --cover $(DOCUMENT_COVER) --extra-css $(TEXTALLIONFOLDER)/includes/epub.css --no-default-epub-cover --no-svg-cover --preserve-cover-aspect-ratio --no-chapters-in-toc
	#
	ebook-meta  $(DOCUMENT).epub --title "$(DOCUMENT_TITLE)" --authors "$(DOCUMENT_AUTHOR)" --tags "$(DOCUMENT_TAGS)" --language $(DOCUMENT_LANGUAGE) --book-producer 'textallion - http://textallion.googlecode.com' --comments 'textallion - http://textallion.googlecode.com' --cover $(DOCUMENT_COVER) 

# split (not working well...)

split:
	htmldoc --no-links --charset utf8 --strict --book -t htmlsep -d ebook $(DOCUMENT)2.html
	#$(TXT2TAGS) -t html --split 2 --no-toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t 

website:
	cat $(TEXTALLIONFOLDER)/templates/website.html | sed -e "s|%%DOCUMENT AUTHOR%%|$(DOCUMENT_AUTHOR)|g" | sed -e "s|%%DOCUMENT TITLE%%|$(DOCUMENT_TITLE)|g" | sed -e "s|%%DOCUMENT%%|$(DOCUMENT)|g"  | sed -e "s|%%DOCUMENT COVER%%|$(DOCUMENT_COVER)|g" > index_$(DOCUMENT).html


cover:
	convert $(DOCUMENT).svg $(DOCUMENT).jpg
	convert $(DOCUMENT).svg $(DOCUMENT).png
	
	
configuration-update:
	$(DIFFTOOL) makefile $(TEXTALLIONFOLDER)/samples/makefile
	$(DIFFTOOL) $(DOCUMENT).sty $(TEXTALLIONFOLDER)/includes/sample.sty
	$(DIFFTOOL) $(DOCUMENT).css $(TEXTALLIONFOLDER)/includes/sample.css

# CYOA part 

cyoa-play:
	$(BROWSER) $(DOCUMENT).html

cyoa-html:
	$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/cyoa.html --config-file $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t -t xhtml --css-inside --outfile $(DOCUMENT).html $(DOCUMENT).t2t
	
	
cyoa-ramus:
	$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/ramus.html  --config-file $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t  -t xhtml --no-css-inside --outfile $(DOCUMENT)_ramus.html $(DOCUMENT).t2t
	sed -i -e "s/href=\"#/rel=\"/g" $(DOCUMENT)_ramus.html
	sed -i -e "s/style=\"display:none\"//g" $(DOCUMENT)_ramus.html
	#sed -i -e "s/onclick\(.*\)rel/rel/" $(DOCUMENT)_ramus.html
	sed -i -e "s/<p><br\/><br\/><br\/><\/p><\/div>/xxCLEARLINKSxx\n<\/div>/g" $(DOCUMENT)_ramus.html
	# remove the 1st occurence only 
	sed -i -e "0,/\xxCLEARLINKSxx/s/\xxCLEARLINKSxx//" $(DOCUMENT)_ramus.html
	# Create the do clear links
	# If you don't like it this way, uncomment the next line first, to remove everything
	#sed -i -e "s/xxCLEARLINKSxx//g" $(DOCUMENT)_ramus.html
	sed -i -e "s/\xxCLEARLINKSxx/\[\?do clear_links\(\)\; \?\]/g" $(DOCUMENT)_ramus.html
	sed -i -e "s/xxRAMUS_INITxx/<div id=\"story\" style=\"Display: none;\">\n<div id=\"start\">\n<li>Start: <b><a rel=\"page1\">1<\/a><\/b>/g" $(DOCUMENT)_ramus.html
	


cyoa-txt:
	$(TXT2TAGS) --no-headers -t txt $(DOCUMENT).t2t

cyoa-pdf:
	#$(TXT2TAGS) -t tex --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
	#-pdflatex $(DOCUMENT).tex
	$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/latex.tex --config-file $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t -t tex --no-toc --outfile $(DOCUMENT).tex $(DOCUMENT).t2t
	-pdflatex -interaction batchmode $(DOCUMENT).tex
	
cyoa-epub:
	$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/cyoa.html --config-file $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t -t xhtml --no-style --no-toc --outfile $(DOCUMENT).html $(DOCUMENT).t2t
	cat $(DOCUMENT).html | sed -e "s/<audio\(.*\)audio>//g" > $(DOCUMENT)2.html
	mv $(DOCUMENT)2.html $(DOCUMENT).html
	-make tidy
	cat $(DOCUMENT).html | sed -e "s/&#10086;/*/g" | sed -e "s/&#10087;/*/g" | sed -e "s/&#10037;/*/g" | sed -e "s/&#9788;/*/g" | sed -e "s/&#9789;/*/g" | sed -e "s/&#9790;/*/g" | sed -e "s/&#9675;/*/g" | sed -e "s/el3.style.visibility = 'hidden';//g" | sed -e "s/div.c3 {display:none}//g" > $(DOCUMENT)2.html
	mv $(DOCUMENT)2.html $(DOCUMENT).html
	#
	ebook-convert $(DOCUMENT).html $(DOCUMENT).epub --max-levels 0 --pretty-print --level1-toc //h:h1 --level2-toc //h:h2 --level3-toc //h:h3 --max-toc-links 0 --toc-threshold 3  --chapter-mark pagebreak --page-breaks-before //h:div[@id] --cover $(DOCUMENT_COVER) --extra-css $(TEXTALLIONFOLDER)/includes/epub.css --no-default-epub-cover --no-svg-cover --preserve-cover-aspect-ratio --no-chapters-in-toc
	#
	ebook-meta  $(DOCUMENT).epub --title "$(DOCUMENT_TITLE)" --authors "$(DOCUMENT_AUTHOR)" --tags "$(DOCUMENT_TAGS)" --language $(DOCUMENT_LANGUAGE) --book-producer 'textallion & txt2cyoa - http://textallion.googlecode.com' --comments 'textallion - http://textallion.googlecode.com' --cover $(DOCUMENT_COVER) 


cyoa-graph:	
	echo -e "\n \n \n"  > graph.txt
	-cat $(TEXTALLIONFOLDER)/core/txt2cyoa.t2t $(DOCUMENT).t2t |grep -E "^#|^>|^==|^-|preproc|postproc" >> graph.txt
	-$(TXT2TAGS) --no-headers -o graph2.txt -t txt graph.txt 
	-echo "digraph G { " > graph.txt
	-echo "bgcolor=beige; "                                          >> graph.txt
	-echo "node [shape=egg, fillcolor=antiquewhite2, style=filled];" >> graph.txt
	-echo "edge [arrowsize=1, fillcolor=gold];"                      >> graph.txt
	-cat graph2.txt | grep -E "\->|;" | sed -e "s/'//g" >> graph.txt
	-echo "} " >> graph.txt
	-cp graph.txt graph2.txt
	#gawk '/->/ { z=$0} /[0-9]+[^->]/ {print z$0}' fichier.txt
	# we convert to graphviz using the python script, and remove the extra "0->" before the conf
	-cat graph2.txt | $(PYTHONVER) $(TEXTALLIONFOLDER)/includes/lines.py  | sed -e "s/0->bgcolor/bgcolor/g" | sed -e "s/0->node/node/g" | sed -e "s/0->edge/edge/g" > graph.txt
	-rm graph2.txt
	-dot graph.txt  -Tpng > $(DOCUMENT)_graph.png
	-dot graph.txt  -Tsvg > $(DOCUMENT)_graph.svg
	-mv graph.txt  $(DOCUMENT)_graph.txt
	
cyoa-gbl:
	echo -e "$(DOCUMENT)\nPar YourName\n%%date(%Y-%m-%d)" > $(DOCUMENT)_gbl.t2t 
	echo "%!includeconf: txt2cyoa.t2t" >> $(DOCUMENT)_gbl.t2t 
	cat $(DOCUMENT).gbl | sed -e "s/= \(.*\) =/\n=== \1 ===\n/g" |\
	# sed -e "s/=\(.*\)=/\n=== \1 ===\n/g" | sed -e "s/= \(.*\)=/\n=== \1 ===\n/g" | sed -e "s/=\(.*\) =/\n=== \1 ===\n/g" |\
	 sed -e "s/^#\([0-9]*\)# \(.*\)/\n\n== \1 ==\n\n=== \2 ===\n\n/g" | sed -e "s/^>\(.*\)=\([0-9]*\)/- \1, rdv au \2/g" >> $(DOCUMENT)_gbl.t2t 

cyoa-togbl:
	cat $(DOCUMENT).t2t | sed -e "s/=== \1 ===/ \(.*\) =/g" |\
	 sed -e "s/^#\([0-9]*\)# \(.*\)/\n\n== \1 ==\n\n=== \2 ===\n\n/g" | sed -e "s/^>\(.*\)=\([0-9]*\)/- \1, rdv au \2/g"  >> $(DOCUMENT)_export.gbl


cyoa-twee:
	# for use with http://gimcrackd.com/etc/src/
	#echo "du texte et puis à la fin de la ligne, un numéro par exemple 42"|sed -e "s/\([0-9]\+\)$/\[\[\1 \1\]\]/g"
	cat $(DOCUMENT).t2t  | perl -pe 's/^\%(.*)\n//' | perl -pe 's/(\d+)\n/[[\1]]\n/' | perl -pe 's/== (\d+) ==/:: \1/' |  perl -pe 's/==(\d+)==\[(.*)\]/:: \2/' > $(DOCUMENT)_export.tw 

cyoa-hyena:
	# for use with http://www.projectaon.org/staff/jens/
	# specifications: http://www.collectingsmiles.com/wiki/index.php?title=Hyena_AudioGame_specifications
	# implementation (player): http://www.freegameengines.org/gamebook-engine/
	echo -e "#start \nStart the game: Click #page0" > $(DOCUMENT)_export.gamebook
	cat $(DOCUMENT).t2t  | perl -pe 's/^\%(.*)\n//' | perl -pe 's/(\d+)\n/Click #page\1\n/' | perl -pe 's/== (\d+) ==/#page\1/' |  perl -pe 's/==(\d+)==\[(.*)\]/page\1/' >> $(DOCUMENT)_export.gamebook 
	echo -e "\n#script\n" >> $(DOCUMENT)_export.gamebook 



cyoa-renpy:
	# for use with http://renpy.org/
	rm -fr $(DOCUMENT)_renpy
	mkdir $(DOCUMENT)_renpy
	# sed can't replace multiple newlines. So we remove them, and add them back later.
	cp -fr $(TEXTALLIONFOLDER)/templates/renpy/* $(DOCUMENT)_renpy
	touch  $(DOCUMENT)_renpy/.nomedia
	cat $(DOCUMENT).t2t   |\
     sed '1,4d' |\
	 perl -pe 's/^\%(.*)\n//' |\
	 perl -pe 's/\n/NEWLINE/' |\
	 perl -pe 's/NEWLINENEWLINE-/\n\n    menu:\n-/g' |\
	 perl -pe 's/NEWLINE/\n/g' |\
	 perl -pe 's/^(.*):\n/    "\1:"/'  |\
	 perl -pe 's/"    menu:\"/menu:\n/'  |\
	 perl -pe 's/(.*) (\d+)[ ]*\n/        "\1":\n            jump page\2\n/' |\
	 perl -pe 's/== (\d+) ==[ ]*\n/\nlabel page\1:\n    scene bg\n    with None\n/' |\
	 perl -pe 's/==(\d+)==\[(.*)\]\n/\nlabel page\1:\n    scene bg\n    with None\n/' |\
	 perl -pe 's/\[\[(.*).jpg] 1\]/    image \1 = "\1.jpg"\n    \x{0024} showmypic("\1")/' |\
	 perl -pe 's/\[\[(.*).png] 1\]/    image \1 = "\1.png"\n    \x{0024} showmypic("\1")/' |\
	 perl -pe 's/\[(.*).jpg\]/    image \1 = "\1.jpg"\n    \x{0024} showmypic("\1")/' |\
	 perl -pe 's/\[(.*).png\]/    image \1 = "\1.png"\n    \x{0024} showmypic("\1")/' |\
	 perl -pe 's/\[(.*).ogg\]/    \x{0024} renpy.music.play("\1.ogg", loop=False)\n/' |\
	 perl -pe 's/..\/images\///g' |\
	 perl -pe 's/¯/ /g' |\
	 perl -pe 's/\[(.*)\]//' |\
	 perl -pe 's/^(.*)\.[ ]*\n/    "\1."/' |\
	 perl -pe 's/^(.*),[ ]*\n/    "\1,"/' |\
	 perl -pe 's/^(.*)”[ ]*\n/    "\1”"/' |\
	 perl -pe 's/^(.*)»[ ]*\n/    "\1»"/' |\
	 perl -pe 's/^(.*)![ ]*\n/    "\1!"/'  |\
	 perl -pe 's/^(.*)\?[ ]*\n/    "\1?"/' |\
	 perl -pe 's/^\/\/(.*)\/\/\n/    "\1"/' |\
	 perl -pe 's/^\*\*(.*)\*\*\n/    "\1"/' |\
	 perl -pe 's/^-(.*)/        "~~ missing line (please review your source code)~~"/' |\
	 perl -pe 's/        \"- /        " /' |\
	 perl -pe 's/\{(.*)\}(.*){(.*)\}/    "\2"/' |\
	 perl -pe 's/\{(.*)\}//' |\
	 perl -pe 's/TESTLUCK/    "Am I lucky today? (throwing a dice, 5 or 6 means luck)"/'|\
	 perl -pe 's/:\":/\":/'|\
	 perl -pe 's/\" THE END \"/jump end/' |\
	 perl -pe 's/THE END/    jump end/'	 >> $(DOCUMENT)_renpy/game/script.rpy 
	 echo -e "\nlabel end:\n    show expression Text(\"THE END.\", size=50, yalign=0.5, xalign=0.5, drop_shadow=(2, 2)) as text\n    with dissolve\n    \" \" " >> $(DOCUMENT)_renpy/game/script.rpy 
	 

cyoa-inform7:
	 sed 's/^$$/ /' $(DOCUMENT).t2t > $(DOCUMENT).tmp  
	 echo -e "== 00 ==" >> $(DOCUMENT).tmp  
	 cat $(DOCUMENT).tmp |\
	 perl -pe 's/==(\d+)==\[(.*)\]/== \1 ==/' |\
	 perl -pe 's/== (\d+) ==/\n== \1 ==\n/' |\
	 perl -pe 's/TESTLUCK/Am I lucky today? (throwing a dice, 5 or 6 means luck)/'|\
	 perl -pe 's/^\%(.*)\n//' |\
	 perl -pe 's/- (.*) \[(.*)\]\n/- \1 \2\n/g' |\
	 perl -pe 's/- (.*) \((.*)\)\n/- \1 \2\n/g' |\
	 perl -pe 's/\[(.*)\]{(.*)\}\n//g' |\
	 perl -pe 's/\[(.*)\]\n//g' |\
	 perl -pe 's/\[(.*)\]//g' |\
	 perl -pe 's/{~~~~}/ /g' |\
	 #perl -pe 's/{(.*)}\n//g' |\
	 #perl -pe 's/{(.*)}//g' |\
	 perl -pe 's/¯/ /g' |\
	 perl -pe 's/\?/\? /g' 	> $(DOCUMENT).tmp2
	 echo -e "\"$(DOCUMENT_TITLE)\" by $(DOCUMENT_AUTHOR)\n\nInclude Adventure Book by Edward Griffiths.\n\n" > $(DOCUMENT).i7
	 echo -e "The first Page is a page. \"Starting the game...\" It is followed by Page1.\n" >> $(DOCUMENT).i7
	 perl $(TEXTALLIONFOLDER)/core/adventurebook.pl $(DOCUMENT).tmp2 >> $(DOCUMENT).i7
	 cat $(DOCUMENT).i7 |\
	 perl -pe 's/\{->--\} FIN \{-<--\} "./". \nIt is followed by GameEnd./' |\
	 perl -pe 's/\{->--\} THE END \{-<--\} "./". \nIt is followed by GameEnd./' > $(DOCUMENT).tmp
	 echo -e "\nGameEnd is a page. \"** THE END **\".\n" >> $(DOCUMENT).tmp
	 mv $(DOCUMENT).tmp $(DOCUMENT).i7


# images (thumbnails)

vignettes:
	sh $(TEXTALLIONFOLDER)/core/vignettes.sh
	mv vignettes_doc.t2t vignettes_$(DOCUMENT).t2t
	sed -i -e "s/@@DOCUMENT_TITLE@@/$(DOCUMENT_TITLE)/"  vignettes_$(DOCUMENT).t2t
	sed -i -e "s/@@DOCUMENT_AUTHOR@@/$(DOCUMENT_AUTHOR)/"  vignettes_$(DOCUMENT).t2t
	$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/xhtml.html -t xhtml --style=$(TEXTALLIONFOLDER)/includes/sample.css --css-inside --no-toc --outfile vignettes_$(DOCUMENT).html vignettes_$(DOCUMENT).t2t


	#$(TXT2TAGS) -T $(TEXTALLIONFOLDER)/templates/xhtml.html -t xhtml --css-inside --toc --outfile #$(DOCUMENT).html $(DOCUMENT).t2t


# CLEAN part 

clean:
	-rm  *~ 
	-rm  .*~
	-rm  $(DOCUMENT).toc
	-rm  $(DOCUMENT).tex
	-rm  $(DOCUMENT)_slide.tex
	-rm  $(DOCUMENT)2.html
	-rm  *.log 
	-rm  *.out
	-rm  *.aux
	-rm  *.toc
	-rm  *.nav
	-rm  *.snm
	-rm  *.ilg
	-rm  *.idx
	-rm  *.ind
	-rm  *.ps

cleanall:
	-rm  *~ 
	-rm  .*~
	-rm -i $(DOCUMENT).pdf
	-rm -i $(DOCUMENT).ps
	-rm -i $(DOCUMENT)_booklet.pdf
	-rm    $(DOCUMENT)_booklet.ps
	-rm -i $(DOCUMENT)-2x1.pdf
	-rm    $(DOCUMENT).toc
	-rm    $(DOCUMENT).tex
	-rm    $(DOCUMENT)_slide.tex
	-rm -i $(DOCUMENT).html
	-rm -i $(DOCUMENT)_slide.html
	-rm -i $(DOCUMENT).epub
	-rm  *.log 
	-rm  *.out
	-rm  *.aux
	-rm  *.toc
	-rm  *.nav
	-rm  *.snm
	-rm  *.ilg
	-rm  *.idx
	-rm  *.ind
	


clean-everything:
	-rm     *~ 
	-rm    .*~
	-rm -i *.pdf
	-rm -i *.ps
	-rm    *.toc
	-rm -i *.tex
	-rm -i *.html
	-rm -i *.epub
	-rm  *.log 
	-rm  *.out
	-rm  *.aux
	-rm  *.toc
	-rm  *.nav
	-rm  *.snm
	-rm  *.ilg
	-rm  *.idx
	-rm  *.ind
	-rm -i *graph.svg
	-rm -i *graph.png
	-rm -i *graph.txt
	-rm -fri tb
	-rm -i vignettes_*
	
gwiki:
	$(TXT2TAGS) -t gwiki  $(DOCUMENT).t2t
	
